<link rel="stylesheet" href="../css/frame2_dy.css?v=1.0.1">
<style>
    .m-dymanic .starts {
        display: flex;
        justify-content: space-between;
        color: #ccc;
        margin-bottom: 5px;
    }

    .m-dymanic .allow {
        display: inline-block;
        background: #f1f1f1;
        color: #b3c1cc;
        border-radius: 3px;
        line-height: 1.2;
        padding: 0 4px;
    }

    .m-dymanic .unAllow {
        font-size: 14px;
        line-height: 2;
    }

    .unAllow .btn-ok {
        background: #5d2d99;
        color: #fff;
        padding: 0 1em;
        border-radius: 5px;
    }

    .unAllow .btn-no {
        margin-left: 1em;
        color: #5d2d99;
        width: 6em;
        text-align: center;
        border: 1px solid;
        border-radius: 5px;
    }

    .imgList {
        width: 4.5em;
        height: 4.5em;
        overflow: hidden;
        margin: 10px 10px 10px 0;
    }

    .imgList.img-h img {
        height: 4.5em;
    }

    .imgList.img-w img {
        width: 4.5em;
    }

    .js-prp {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
    }

    .js-prp .img {
        position: absolute;
        top: 25%;
        height: 50%;
        width: 80%;
        margin: 0 10%;
    }

    .tx {
        border-radius: 50%;
    }
</style>
<div id="view" v-cloak>

    <ul class="m-dymanic">
        <!-- <li class="li" >
                <div class="left tx img-h" >
                    <img src="../image/test/01.jpg" alt="">
                </div>
                <div class="rt">
                    <p style="color: #545454;font-size: 14px">
                        <span style="color:#1fb4f6">张三</span> {{ item.desc }}
                    </p>
                    <div class="imgList img-h flex-c">
                        <img src="../image/test/01.jpg" alt="" ng-click="seeImg( imgurl + item.pic )">
                    </div>
                    <p class="starts" ng-click="userData(item.user_id)">
                        <span>{{item.addtime}}</span>
                        <span>前往查看 ></span>
                    </p>
                    <span class="allow" v-if="item.state==1">已通过请求</span>
                    <span class="allow" v-if="item.state==2">该用户拒绝了你的请求</span>
                    <div class="unAllow" v-if="item.state==0" style="padding-top: 6px;">
                        <span class="btn-ok" ng-click="agreeimg(item.id)">允许(有效期15天)</span>
                        <span class="btn-no" ng-click="refuseimg(item.id)">拒绝</span>
                        <p style="margin-top: 5px;color:#ccc;">允许有效期15天</p>
                    </div>
                </div>
            </li> -->
        <li class="li" v-for="(item, index) in ffList">
            <div class="left tx img-h">
                <img :src="imgurl+item.head" @load="imgCss(imgurl+item.head, $event)"
                    onerror="this.onerror=null;this.src='../image/touxiang.png'" alt="">
            </div>
            <div class="rt">
                <p style="color: #545454;font-size: 14px">
                    <span style="color:#1fb4f6">{{ item.name }}</span> {{ item.desc }}
                </p>
                <div class="imgList img-h flex-c" v-if="!item.pic" @click.stop
                    @click="_url({imgArr:item.pic, iIndex:sindex, url: 'frame1/dy_img', title: '查看图片'})">
                    <img :src="imgurl + item.pic" @load="imgCss(imgurl + item.pic, $event)"
                        onerror="this.onerror=null;this.src='../image/error-img.png.png'" alt="">
                </div>
                <p class="starts" @click.stop @click="go_userInfo(item.user_id, item.name)">
                    <span>{{item.addtime}}</span>
                    <span>前往查看 ></span>
                </p>
                <span class="allow" v-if="item.state==1">已通过请求</span>
                <span class="allow" v-if="item.state==2">该用户拒绝了你的请求</span>
                <div class="unAllow" v-if="item.state==0" style="padding-top: 6px;">
                    <span class="btn-ok" v-click="agreeimg(item.id, 1, index)">允许(有效期15天)</span>
                    <span class="btn-no" v-click="agreeimg(item.id, 2, index)">拒绝</span>
                    <p style="margin-top: 5px;color:#ccc;">允许有效期15天</p>
                </div>
            </div>
        </li>
    </ul>
    <div id="no_more"></div>
</div>
<script>
    var view = new Vue({
        el: '#view',
        data: {
            imgurl: imgurl,
            ffList: [],
            ffInfo: {},
        },
        methods: {
            _url: function (param, url) {
                _url(param, url);
            },
            // 图片自适应
            imgCss: function (url, event) {
                var e = event.currentTarget;
                imgCss(url, function (w, h) {
                    if (w < h) {
                        $(e).parent().addClass('img-w').removeClass('img-h');
                    }
                })
            },
            // 查看用户资料
            go_userInfo: function (id, name, sex) {
                go_userInfo(id, name, sex)
            },
            // 允许查看图片
            agreeimg: function (id, type, index) {
                var url = type == 1 ? 'home/User/agreeimg' : 'home/User/refuseimg';
                _ajax(url, function (ret, err) {
                    _log(JSON.stringify(ret));
                    _log(JSON.stringify(err));
                    var _this = this;
                    var msg = ret.code == 200 ? (type == 1 ? '该用户从现在开始可以查看你的详情页了' : '已回绝') : ret .msg;
                    _msg(msg);
                    if (ret && ret.code == 200) {
                        _this.ffList[index].state = type;
                        pushMsg(_this.ffList[index].user_id);
                    }
                }, { id: id, })
            }
        }
    })
    judgeLogin()
    var param = {
        user_id: myuserid,
    };
    _lists('home/User/requestlist', 0, 1, param);
    _scrollToBottom(function () {
        if (heigutgao == 1) {
            pagenum++;
            _lists('home/User/requestlist', pagenum, '', param);
        }
    })
</script>